const db = wx.cloud.database({
  env: 'cloud1-2g6vpgs796710242'
})

Page({
  data: {
    userID:"",
    cp:[],
  },

  onLoad: function (e) {
    this.gethistory(e.openid)
    // new Promise(function (resolve) {
    //   resolve();
    // }).then(() =>{
      
    // }).then(() =>{
      
    // })
  },

  gethistory (e) {
    db.collection('Search_history')
    .where({
      _openid:e
    })
    .get()
    .then(res=>{
      console.log(res)
      this.setData({
        cp:res.data.reverse()
      })
    })
    .catch(err=>{
      console.log("历史数据获取失败",err)
    })
  },

  onShareAppMessage: function () {

  }
})